# the directory which include source files or head files
cmake_minimum_required (VERSION 2.6)
project (lwplc)

INCLUDE(FindPkgConfig)
INCLUDE(UsePkgConfig)

set(CMAKE_BUILD_TYPE Debug)

set(PREFIX "${PROJECT_SOURCE_DIR}")
set(CMAKE_INSTALL_PREFIX "${PREFIX}")

set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

set(srcdirs
  ${PROJECT_SOURCE_DIR}
)

set(CMAKE_BUILD_TYPE Debug)

INCLUDE_DIRECTORIES(
  ${PROJECT_SOURCE_DIR}/
)

link_directories(
  ${PROJECT_SOURCE_DIR}/
)


SET(USE_GTK_VERSION gtk+-2.0)

###########################
## GTK
###########################
MESSAGE("[INFO] 要求使用GTK版本为:"${USE_GTK_VERSION})
PKG_CHECK_MODULES(GTK REQUIRED ${USE_GTK_VERSION}) 
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK_LIBRARY_DIRS})
MESSAGE("[INFO] 实际使用GTK版本为:"${GTK_VERSION})


#ADD_SUBDIRECTORY(tools)

foreach(srcdir ${srcdirs})
  include_directories(${srcdir})
  aux_source_directory(${srcdir} library_source_files)
endforeach()

add_executable(lwplc ${library_source_files})
target_link_libraries(lwplc ${GTK_LIBRARIES})

install(TARGETS lwplc DESTINATION bin)
